<script setup>
import {ref} from "vue";
import {useRouter} from "vue-router";
const router = useRouter();
const routePush = (path)=>{
  router.push(path);
}
const keywords = ref(null)
</script>

<template>
<main class="main-container">
  <p class="search-header">
    站内搜索
  </p>
  <div class="search-container">
      <van-search  style="margin: 0" v-model="keywords" input-align="center"
                  :left-icon="null" right-icon="search" placeholder="请输入搜索关键词" />
    <div class="search-result">
      <div class="result-card" @click="routePush('/product/1')">
        <van-image radius="5px" width="100%"  height="160px" src="https://oss.toubutu.com/yexing/image/p1.jpg"/>
        <p class="product-name">这是产品名称</p>
        <p class="product-desc">这是产品介绍</p>
      </div>
      <div class="result-card" @click="routePush('/product/1')">
        <van-image radius="5px" width="100%"  height="160px" src="https://oss.toubutu.com/yexing/image/p2.jpg"/>
        <p class="product-name">这是产品名称</p>
        <p class="product-desc">这是产品介绍</p>
      </div>
      <div class="result-card" @click="routePush('/product/3')">
        <van-image radius="5px" width="100%"  height="160px" src="https://oss.toubutu.com/yexing/image/p2.jpg"/>
        <p class="product-name">这是产品名称</p>
        <p class="product-desc">这是产品介绍</p>
      </div>
    </div>

  </div>
</main>
</template>

<style scoped>
.main-container{
  background: #fafafa;
}
.search-header{
  width: 100%;
  height: 48px;
  font-size: 24px;
  letter-spacing: 1px;
  text-align: center;
  line-height: 48px;
  background-color: white;
}
.search-container{
  margin: 10px 15px 0 15px;

}
.search-result{
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.result-card{
  padding: 5px;
  border-radius: 5px;
  box-shadow: 0 12px 32px 4px rgba(0, 0, 0, .04), 0 8px 20px rgba(0, 0, 0, .08);
  margin-bottom: 10px;
}
.product-name{
  padding: 5px;
  font-size: 18px;
  font-weight: bold;
}
.product-desc{
  padding: 0 5px;
  font-size: 14px;
}
</style>